package com.suntianci.stock.mapper;

import com.alibaba.druid.sql.ast.statement.SQLForeignKeyImpl;
import com.suntianci.stock.pojo.domain.InnerMarketDomain;
import com.suntianci.stock.pojo.entity.StockMarketIndexInfo;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* @author 孙天赐
* @description 针对表【stock_market_index_info(国内大盘数据详情表)】的数据库操作Mapper
* @createDate 2024-12-24 15:39:27
* @Entity com.suntianci.stock.pojo.entity.StockMarketIndexInfo
*/
public interface StockMarketIndexInfoMapper {

    int deleteByPrimaryKey(Long id);

    int insert(StockMarketIndexInfo record);

    int insertSelective(StockMarketIndexInfo record);

    StockMarketIndexInfo selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(StockMarketIndexInfo record);

    int updateByPrimaryKey(StockMarketIndexInfo record);

    /**
     * 获取国内大盘最新的数据
     * @param lastDate 最新的时间点
     * @param marketCodes 大盘编码集合
     * @return
     */
    List<InnerMarketDomain> getMarketInfo(@Param("lastDate") Date lastDate, @Param("marketCodes") List<String> marketCodes);

    /**
     * 获取指定交易日期内的国内大盘成交量
     * 注意: 1.List里面要写Map
     *       2.sql语句的resultType为Map，而不是List
     * @param openDate
     * @param endDate
     * @param innerCodes
     * @return
     */
    List<Map> getstockTradeAmo(@Param("openDate") Date openDate, @Param("endDate") Date endDate, @Param("innerCodes") List<String> innerCodes);

    /**
     * 批量插入大盘数据
     * @param marketEntities 大盘实体集合
     * @return
     */
    int batchInsert(@Param("marketEntities") List<StockMarketIndexInfo> marketEntities);
}
